<script setup>
import { useUserOut } from '@/store/user';
import { ref, provide, computed, onMounted } from 'vue'
import { storeToRefs } from 'pinia';


const userStore = useUserOut()
const { authenticated } = storeToRefs(userStore);
provide('authenticated', authenticated);
provide(
  'currentUsername',
  computed(() => userStore.userIdentity?.login),
);

onMounted(() => {

})
</script>

<template>
  <div class="app-container">
    <nav>
      <RouterLink to="/">首页</RouterLink>
      <RouterLink to="/book">Book</RouterLink>
    </nav>
    <div class="body">
      <RouterView />
    </div>
  </div>
</template>

<style scoped>
nav, main {
  border: 2px solid #000;
  margin-bottom: 10px;
  padding: 10px;
}

nav > a + a {
  margin-left: 10px;
}

h2 {
  border-bottom: 1px solid #ccc;
  margin: 0 0 20px;
}
</style>
